/**
 * $Id: EditorLightweightLabel.java,v 1.2 2011-01-12 13:43:54 gaudenz Exp $
 * Copyright (c) 2007, Gaudenz Alder
 */
package com.kg.rails.component.editor.util;

import javax.swing.*;
import java.awt.*;

/**
 * @author Administrator
 */
public class EditorLightweightLabel extends JLabel {

    /**
     *
     */
    private static final long serialVersionUID = -6771477489533614010L;

    /**
     *
     */
    protected static EditorLightweightLabel sharedInstance;

    /**
     * Initializes the shared instance.
     */
    static {
        try {
            sharedInstance = new EditorLightweightLabel();
        } catch (Exception e) {
            // ignore
        }
    }

    /**
     *
     */
    public static EditorLightweightLabel getSharedInstance() {
        return sharedInstance;
    }

    /**
     *
     *
     */
    public EditorLightweightLabel() {
        setFont(new Font(Constants.DEFAULT_FONTFAMILY, 0,
                Constants.DEFAULT_FONTSIZE));
        setVerticalAlignment(SwingConstants.TOP);
    }

    /**
     * Overridden for performance reasons.
     */
    public void validate() {
    }

    /**
     * Overridden for performance reasons.
     */
    public void revalidate() {
    }

    /**
     * Overridden for performance reasons.
     */
    public void repaint(long tm, int x, int y, int width, int height) {
    }

    /**
     * Overridden for performance reasons.
     */
    public void repaint(Rectangle r) {
    }

    /**
     * Overridden for performance reasons.
     */
    protected void firePropertyChange(String propertyName, Object oldValue,
                                      Object newValue) {
        // Strings get interned...
        if (propertyName == "text" || propertyName == "font") {
            super.firePropertyChange(propertyName, oldValue, newValue);
        }
    }

    /**
     * Overridden for performance reasons.
     */
    public void firePropertyChange(String propertyName, byte oldValue,
                                   byte newValue) {
    }

    /**
     * Overridden for performance reasons.
     */
    public void firePropertyChange(String propertyName, char oldValue,
                                   char newValue) {
    }

    /**
     * Overridden for performance reasons.
     */
    public void firePropertyChange(String propertyName, short oldValue,
                                   short newValue) {
    }

    /**
     * Overridden for performance reasons.
     */
    public void firePropertyChange(String propertyName, int oldValue,
                                   int newValue) {
    }

    /**
     * Overridden for performance reasons.
     */
    public void firePropertyChange(String propertyName, long oldValue,
                                   long newValue) {
    }

    /**
     * Overridden for performance reasons.
     */
    public void firePropertyChange(String propertyName, float oldValue,
                                   float newValue) {
    }

    /**
     * Overridden for performance reasons.
     */
    public void firePropertyChange(String propertyName, double oldValue,
                                   double newValue) {
    }

    /**
     * Overridden for performance reasons.
     */
    public void firePropertyChange(String propertyName, boolean oldValue,
                                   boolean newValue) {
    }

}
